package com.lenovo.lcdm.dcm.config.swagger;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * SpringDoc 配置类
 *
 * @author： lihc14
 **/
@Configuration
public class OpenApiConfig {

    @Value("${springdoc.swagger-ui.enabled:false}")
    private Boolean enable;

    /**
     * SpringDoc 标题、描述、版本等信息配置
     *
     * @return openApi 配置信息
     */
    @Bean
    public OpenAPI springDocOpenAPI() {
        if(!enable){
            return null;
        }
        return new OpenAPI().info(new Info()
                        .title("LCDM-API")
                        .description("LCDM API")
                        .version("v1.0.0")
                        .license(new License().name("LCDM").url("")));
    }
}
